package com.jt61016.ch04.clone;

public class ResumeClone implements Cloneable {
    /**
     * 姓名
     */
    private String name;
    /**
     * 性别
     */
    private String sex;
    /**
     * 年龄
     */
    private Integer age;

    /**
     * 工作经历-时间
     */
    private String timeArea;
    /**
     * 工作经历-公司
     */
    private String company;

    public ResumeClone(String name) {
        this.name = name;
    }

    public void setPersonalInfo(String sex, Integer age) {
        this.sex = sex;
        this.age = age;
    }

    public void setWorkExperience(String timeArea, String company) {
        this.timeArea = timeArea;
        this.company = company;
    }

    @Override
    public ResumeClone clone() {
        Object clone = null;
        try {
            clone = super.clone();
        } catch (CloneNotSupportedException e) {
            System.out.println(e.getStackTrace());
        }
        return (ResumeClone)clone;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(name)
                .append(" ")
                .append(sex)
                .append(" ")
                .append(age)
                .append(" 工作经历：")
                .append(timeArea)
                .append(" ")
                .append(company);
        return sb.toString();
    }

}
